package org.maplanning;

public class Matrix {
	double[] values;
	int rows, cols;
	
	/**
	 * Creates height x width map with values equal to 0.
	 * @param height
	 * @param width
	 */
	public Matrix(int rows, int cols) {
		this.rows = rows;
		this.cols = cols;
		this.values = new double[rows*cols];
	}
	
	/** sets value at (row, col) to value */
	public void set(int row, int col, double value) {
		this.values[col*rows+row] = value;
	}

	public void set(int[] x, double value) {
		this.set(x[0], x[1], value);
	}

	/** @return value at (row, col) */
	public double get(int row, int col) {
		return this.values[col*rows+row];
	}

	public double get(int[] x) {
		return this.get(x[0], x[1]);
	}

}
